<template>
  <el-scrollbar class="page_content">
    <el-container>
      <!-- 头部 -->
      <el-header>
        <div class="header flex justify_content_between align_content_center">
          <div class="flexed align_content_center">
            <span class="title">{{ title }}</span>
          </div>
          <div class="flex align_item_center">
            <el-icon size="22" color="red" style="height: 22px; margin-right: 22px">
              <BellFilled />
            </el-icon>
            <el-dropdown>
              <span class="representational flex align_content_center">
                <el-image class="avatar" src="https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg"
                  fit="cover"></el-image>
                <el-icon size="16px" color="#fff" style="height: 26px; margin-left: 6px">
                  <arrow-down />
                </el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item>个人中心</el-dropdown-item>
                  <el-dropdown-item>退出</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </div>
      </el-header>
      <!-- 内容 -->
      <el-container class="inner_content">
        <!-- 菜单栏 -->
        <el-aside width="200px">
          <menuColumn :isCollapse="isCollapse" :openeds="openeds"  :active="active" @currLabelEmits="currLabelEmits"></menuColumn>
        </el-aside>
        <el-main>
          <!-- 导航栏 -->
          <labelColumn :currLabelValue="currLabelValue" @currLabelEmits="currLabelEmits"></labelColumn>
          <!-- 路由出口 -->
          <RouterView></RouterView>
        </el-main>
      </el-container>
    </el-container>
  </el-scrollbar>
</template>

<script lang="ts" setup>
// 相关api与组件引入
import { ref, onBeforeMount } from "vue";
import { useRoute, useRouter } from "vue-router";
import { ArrowDown, BellFilled } from "@element-plus/icons-vue";
import menuColumn from "@/components/menuColumn.vue";
import labelColumn from "@/components/labelColumn.vue";
import type { TabPaneName } from 'element-plus';
import { useCommonStore } from "@/stores/common";
let { labelList, saveLabelList, currLabel, saveCurrLabel } = useCommonStore();
//相关变量初始化
const title = ref("城市生活服务平台");
const router = useRouter();
const route = useRoute();
const isCollapse = ref(true);
const openeds = ref([]);
const active = ref("");
const currLabelValue = ref(currLabel);
// 侧边栏点击改变当前导航栏位置
const currLabelEmits = (ploay:any)=>{
  currLabelValue.value = ploay.name,
  openeds.value = ploay.openeds,
  active.value = ploay.active
}
// 生命周期
onMounted(()=>{
  openeds.value = route.meta.openeds as any;
  active.value = route.meta.active as string;
  console.log(openeds.value,"openeds.value")
  console.log(active.value,"active.value")

});
</script>

<style scoped lang="scss">
.page_content {
  .header {
    width: 100vw;
    height: 60px;
    background-color: #4e6ef2;
    box-sizing: border-box;
    padding: 10px 20px;
    color: #ffffff;
    position: fixed;
    left: 0;
    top: 0;

    .title {
      font-size: 16px;
      font-weight: 400;
    }

    .representational {
      .avatar {
        width: 26px;
        height: 26px;
        display: inline-block;
        border-radius: 50%;
      }
    }
  }
  .inner_content{
    width: 100vw;
    height: calc(100vh - 60px);
  }
}
</style>